var assert = require('assert');

function _genObj(key, value) {
    var result = {}, keys = key.split('.'), _key = keys.pop();
    result[_key] = value;
    if (keys.length) {
        return _genObj(keys.join('.'), result);
    }
    return result;
}
var result = _genObj('a.b.c', {name:'test'});
assert.equal(result.a.b.c.name, 'test', '_genObj(key, value) 测试失败!');

/**
 * replaceAll
 */
var str = 'a.b.c';
var replaceResult = str.replace(/\./g, '.children.');
console.log(replaceResult);